package com.spring.dao;

import org.springframework.context.support.AbstractApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 *
 * @ClassName: Test
 * @Description: TODO
 * @Version V1.0
 **/
public class Test {
    public static void main(String[] args) {
        //使用AbstractApplicationContext虚类
        AbstractApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
        //直接注册jvm
        context.registerShutdownHook();
        UserDao userDao = (UserDao)context.getBean(UserDao.class);
        userDao.save();

        //手动销毁
        context.close();
    }
}
